class_name Stats
extends Node

signal health_chenged
signal energy_chenged

@export var max_health: int = 3
@export var max_energy: float = 10
@export var energy_regn: float = 0.8

@onready var health: int = max_health:
	set(value):
		value = clampi(value,0,max_health)
		if health == value:
			return
		health = value
		health_chenged.emit()
		
@onready var energy: float = max_energy:
	set(value):
		value = clampf(value,0,max_energy)
		if energy == value:
			return
		energy = value
		energy_chenged.emit()

func _process(delta: float) -> void:
	energy += energy_regn*delta
